package com.lxw.multidb.controller.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件-上传参数
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2025/5/7 16:33
 */
@Schema(description = "文件-上传参数")
@Getter
@Setter
@ToString
public class UploadDTO {

    @Schema(description = "前置路径")
    private String prefix;

    @Schema(description = "资源文件", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull
    private MultipartFile file;


    public String getPrefix() {
        if (prefix == null) {
            return "";
        }
        return prefix + "/";
    }
}
